Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Buffers.​ArrayBufferWriter<​T>

Assembly: System.Memory

Inheritance: object → ArrayBufferWriter

Implemented Interfaces

Represents a heap-based, array-backed output sink into which <typeparamref name="T" /> data can be written.

Properties

public int
Capacity
Gets the total amount of space within the underlying buffer.
public int
FreeCapacity
Gets the amount of available space that can be written to without forcing the underlying buffer to grow.
public int
WrittenCount
Gets the amount of data written to the underlying buffer.
public ReadOnlyMemory<​T>
WrittenMemory
Gets a <see cref="T:System.ReadOnlyMemory`1" /> that contains the data written to the underlying buffer so far.
public ReadOnlySpan<​T>
WrittenSpan
Gets a <see cref="T:System.ReadOnlySpan`1" /> that contains the data written to the underlying buffer so far.

Methods

public void
Advance​(int count)
Notifies the <see cref="T:System.Buffers.IBufferWriter`1" /> that <paramref name="count" /> items were written to the output <see cref="T:System.Span`1" /> / <see cref="T:System.Memory`1" /> .
count The number of items written.
public void
Clear​()
Clears the data written to the underlying buffer.
public void
ResetWrittenCount​()
Resets the data written to the underlying buffer without zeroing its content.
public Memory<​T>
GetMemory​(int sizeHint = 0)
Returns a <see cref="T:System.Memory`1" /> to write to that is at least the length specified by <paramref name="sizeHint" /> .
Returns A <see cref="T:System.Memory`1" /> whose length is at least <paramref name="sizeHint" /> . If <paramref name="sizeHint" /> is not provided or is equal to 0, some non-empty buffer is returned.
sizeHint The minimum requested length of the <see cref="T:System.Memory`1" /> .
public Span<​T>
GetSpan​(int sizeHint = 0)
Returns a <see cref="T:System.Span`1" /> to write to that is at least a specified length.
Returns A span of at least <paramref name="sizeHint" /> in length. If <paramref name="sizeHint" /> is not provided or is equal to 0, some non-empty buffer is returned.
sizeHint The minimum requested length of the <see cref="T:System.Span`1" /> .
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object